# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     lib_utils
   Description :
   Author :       Flyoung
   date：          2023/4/16
-------------------------------------------------
   Change Activity:
                   2023/4/16:
-------------------------------------------------
"""
from lib import custom_terminators
from typing import Union


def get_start_terminator(s: str) -> Union[str, None]:
    # 获取 s 中开头的非终结符
    for non_terminal in custom_terminators:
        if s.startswith(non_terminal):
            return non_terminal
    return None


def get_end_terminator(s: str) -> Union[str, None]:
    for non_terminal in custom_terminators:
        if s.endswith(non_terminal):
            return non_terminal
    return None
